// must have dojo-lotex before
dojo.registerModulePath ("velcro","../../velcro/src");

/*
lotexConfig.baseurl = lotexConfig.online ?
    "http://localhost:8080" :
    "file:///D:/rptp/trunk/ajaj/velcro/resource";
*/

lotexConfig.baseurl = "http://localhost:8080";

var velcroConfig = {};
velcroConfig["home"] = "file:///D:/rptp/trunk/ajaj/velcro";
velcroConfig["project"] = "opu";
velcroConfig["projectPath"] = velcroConfig["home"] + '/projects/'
    + velcroConfig["project"];

velcroConfig["selectItemFile"] = velcroConfig["projectPath"] + '/'
    + velcroConfig["project"] + '.selectitem.txt';
velcroConfig["humresFile"] = velcroConfig["projectPath"] + '/'
    + velcroConfig["project"] + '.humres.txt';

dojo.getObject("velcro.sql",true);
velcro.sql = function(param) {
    var enc = encodeURIComponent;
    var _url= lotexConfig.baseurl
        + "/ServiceAction/com.velcro.base.DataAction?sql="+enc(param);
d(_url);
    var kw = {
        url: _url,
        method: "get",
        sync: true,
        mimetype: "text/plain",
        load: function(type, data, evt) {
            d(data);

        },
        error: function(t, e) {
            alert("Error!");
            dd(t, e);
        }
    };
    dojo.io.bind(kw);
};

prespace = function(str){
    //把tag转为空格？
    var sc = 0;
    for (var i=0;i<str.length;i++) {
        if(str.charAt(i) == " ") sc++;
        else break;
    }
    return sc;
}